(0) Obligation:

Clauses:

max(X, Y, X) :- less(Y, X).
max(X, Y, Y) :- less(X, s(Y)).
less(0, s(X1)).
less(s(X), s(Y)) :- less(X, Y).

Query: max(a,a,g)

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph ICLP10.

(2) Obligation:

Clauses:

lessA(0, s(T31)).
lessA(s(T38), s(T37)) :- lessA(T38, T37).
maxB(s(T13), 0, s(T13)).
maxB(s(T23), s(T24), s(T23)) :- lessA(T24, T23).
maxB(T47, T46, T46) :- lessA(T47, s(T46)).
maxB(0, T59, T59).
maxB(s(T66), T65, T65) :- lessA(T66, T65).

Query: maxB(a,a,g)

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
maxB_in: (f,f,b)
lessA_in: (f,b)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

maxB_in_aag(s(T13), 0, s(T13)) → maxB_out_aag(s(T13), 0, s(T13))
maxB_in_aag(s(T23), s(T24), s(T23)) → U2_aag(T23, T24, lessA_in_ag(T24, T23))
lessA_in_ag(0, s(T31)) → lessA_out_ag(0, s(T31))
lessA_in_ag(s(T38), s(T37)) → U1_ag(T38, T37, lessA_in_ag(T38, T37))
U1_ag(T38, T37, lessA_out_ag(T38, T37)) → lessA_out_ag(s(T38), s(T37))
U2_aag(T23, T24, lessA_out_ag(T24, T23)) → maxB_out_aag(s(T23), s(T24), s(T23))
maxB_in_aag(T47, T46, T46) → U3_aag(T47, T46, lessA_in_ag(T47, s(T46)))
U3_aag(T47, T46, lessA_out_ag(T47, s(T46))) → maxB_out_aag(T47, T46, T46)
maxB_in_aag(0, T59, T59) → maxB_out_aag(0, T59, T59)
maxB_in_aag(s(T66), T65, T65) → U4_aag(T66, T65, lessA_in_ag(T66, T65))
U4_aag(T66, T65, lessA_out_ag(T66, T65)) → maxB_out_aag(s(T66), T65, T65)

The argument filtering Pi contains the following mapping:
maxB_in_aag(x1, x2, x3)  =  maxB_in_aag(x3)
s(x1)  =  s(x1)
maxB_out_aag(x1, x2, x3)  =  maxB_out_aag(x1, x2)
U2_aag(x1, x2, x3)  =  U2_aag(x1, x3)
lessA_in_ag(x1, x2)  =  lessA_in_ag(x2)
lessA_out_ag(x1, x2)  =  lessA_out_ag(x1)
U1_ag(x1, x2, x3)  =  U1_ag(x3)
U3_aag(x1, x2, x3)  =  U3_aag(x2, x3)
U4_aag(x1, x2, x3)  =  U4_aag(x2, x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

maxB_in_aag(s(T13), 0, s(T13)) → maxB_out_aag(s(T13), 0, s(T13))
maxB_in_aag(s(T23), s(T24), s(T23)) → U2_aag(T23, T24, lessA_in_ag(T24, T23))
lessA_in_ag(0, s(T31)) → lessA_out_ag(0, s(T31))
lessA_in_ag(s(T38), s(T37)) → U1_ag(T38, T37, lessA_in_ag(T38, T37))
U1_ag(T38, T37, lessA_out_ag(T38, T37)) → lessA_out_ag(s(T38), s(T37))
U2_aag(T23, T24, lessA_out_ag(T24, T23)) → maxB_out_aag(s(T23), s(T24), s(T23))
maxB_in_aag(T47, T46, T46) → U3_aag(T47, T46, lessA_in_ag(T47, s(T46)))
U3_aag(T47, T46, lessA_out_ag(T47, s(T46))) → maxB_out_aag(T47, T46, T46)
maxB_in_aag(0, T59, T59) → maxB_out_aag(0, T59, T59)
maxB_in_aag(s(T66), T65, T65) → U4_aag(T66, T65, lessA_in_ag(T66, T65))
U4_aag(T66, T65, lessA_out_ag(T66, T65)) → maxB_out_aag(s(T66), T65, T65)

The argument filtering Pi contains the following mapping:
maxB_in_aag(x1, x2, x3)  =  maxB_in_aag(x3)
s(x1)  =  s(x1)
maxB_out_aag(x1, x2, x3)  =  maxB_out_aag(x1, x2)
U2_aag(x1, x2, x3)  =  U2_aag(x1, x3)
lessA_in_ag(x1, x2)  =  lessA_in_ag(x2)
lessA_out_ag(x1, x2)  =  lessA_out_ag(x1)
U1_ag(x1, x2, x3)  =  U1_ag(x3)
U3_aag(x1, x2, x3)  =  U3_aag(x2, x3)
U4_aag(x1, x2, x3)  =  U4_aag(x2, x3)

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

MAXB_IN_AAG(s(T23), s(T24), s(T23)) → U2_AAG(T23, T24, lessA_in_ag(T24, T23))
MAXB_IN_AAG(s(T23), s(T24), s(T23)) → LESSA_IN_AG(T24, T23)
LESSA_IN_AG(s(T38), s(T37)) → U1_AG(T38, T37, lessA_in_ag(T38, T37))
LESSA_IN_AG(s(T38), s(T37)) → LESSA_IN_AG(T38, T37)
MAXB_IN_AAG(T47, T46, T46) → U3_AAG(T47, T46, lessA_in_ag(T47, s(T46)))
MAXB_IN_AAG(T47, T46, T46) → LESSA_IN_AG(T47, s(T46))
MAXB_IN_AAG(s(T66), T65, T65) → U4_AAG(T66, T65, lessA_in_ag(T66, T65))
MAXB_IN_AAG(s(T66), T65, T65) → LESSA_IN_AG(T66, T65)

The TRS R consists of the following rules:

maxB_in_aag(s(T13), 0, s(T13)) → maxB_out_aag(s(T13), 0, s(T13))
maxB_in_aag(s(T23), s(T24), s(T23)) → U2_aag(T23, T24, lessA_in_ag(T24, T23))
lessA_in_ag(0, s(T31)) → lessA_out_ag(0, s(T31))
lessA_in_ag(s(T38), s(T37)) → U1_ag(T38, T37, lessA_in_ag(T38, T37))
U1_ag(T38, T37, lessA_out_ag(T38, T37)) → lessA_out_ag(s(T38), s(T37))
U2_aag(T23, T24, lessA_out_ag(T24, T23)) → maxB_out_aag(s(T23), s(T24), s(T23))
maxB_in_aag(T47, T46, T46) → U3_aag(T47, T46, lessA_in_ag(T47, s(T46)))
U3_aag(T47, T46, lessA_out_ag(T47, s(T46))) → maxB_out_aag(T47, T46, T46)
maxB_in_aag(0, T59, T59) → maxB_out_aag(0, T59, T59)
maxB_in_aag(s(T66), T65, T65) → U4_aag(T66, T65, lessA_in_ag(T66, T65))
U4_aag(T66, T65, lessA_out_ag(T66, T65)) → maxB_out_aag(s(T66), T65, T65)

The argument filtering Pi contains the following mapping:
maxB_in_aag(x1, x2, x3)  =  maxB_in_aag(x3)
s(x1)  =  s(x1)
maxB_out_aag(x1, x2, x3)  =  maxB_out_aag(x1, x2)
U2_aag(x1, x2, x3)  =  U2_aag(x1, x3)
lessA_in_ag(x1, x2)  =  lessA_in_ag(x2)
lessA_out_ag(x1, x2)  =  lessA_out_ag(x1)
U1_ag(x1, x2, x3)  =  U1_ag(x3)
U3_aag(x1, x2, x3)  =  U3_aag(x2, x3)
U4_aag(x1, x2, x3)  =  U4_aag(x2, x3)
MAXB_IN_AAG(x1, x2, x3)  =  MAXB_IN_AAG(x3)
U2_AAG(x1, x2, x3)  =  U2_AAG(x1, x3)
LESSA_IN_AG(x1, x2)  =  LESSA_IN_AG(x2)
U1_AG(x1, x2, x3)  =  U1_AG(x3)
U3_AAG(x1, x2, x3)  =  U3_AAG(x2, x3)
U4_AAG(x1, x2, x3)  =  U4_AAG(x2, x3)

We have to consider all (P,R,Pi)-chains

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MAXB_IN_AAG(s(T23), s(T24), s(T23)) → U2_AAG(T23, T24, lessA_in_ag(T24, T23))
MAXB_IN_AAG(s(T23), s(T24), s(T23)) → LESSA_IN_AG(T24, T23)
LESSA_IN_AG(s(T38), s(T37)) → U1_AG(T38, T37, lessA_in_ag(T38, T37))
LESSA_IN_AG(s(T38), s(T37)) → LESSA_IN_AG(T38, T37)
MAXB_IN_AAG(T47, T46, T46) → U3_AAG(T47, T46, lessA_in_ag(T47, s(T46)))
MAXB_IN_AAG(T47, T46, T46) → LESSA_IN_AG(T47, s(T46))
MAXB_IN_AAG(s(T66), T65, T65) → U4_AAG(T66, T65, lessA_in_ag(T66, T65))
MAXB_IN_AAG(s(T66), T65, T65) → LESSA_IN_AG(T66, T65)

The TRS R consists of the following rules:

maxB_in_aag(s(T13), 0, s(T13)) → maxB_out_aag(s(T13), 0, s(T13))
maxB_in_aag(s(T23), s(T24), s(T23)) → U2_aag(T23, T24, lessA_in_ag(T24, T23))
lessA_in_ag(0, s(T31)) → lessA_out_ag(0, s(T31))
lessA_in_ag(s(T38), s(T37)) → U1_ag(T38, T37, lessA_in_ag(T38, T37))
U1_ag(T38, T37, lessA_out_ag(T38, T37)) → lessA_out_ag(s(T38), s(T37))
U2_aag(T23, T24, lessA_out_ag(T24, T23)) → maxB_out_aag(s(T23), s(T24), s(T23))
maxB_in_aag(T47, T46, T46) → U3_aag(T47, T46, lessA_in_ag(T47, s(T46)))
U3_aag(T47, T46, lessA_out_ag(T47, s(T46))) → maxB_out_aag(T47, T46, T46)
maxB_in_aag(0, T59, T59) → maxB_out_aag(0, T59, T59)
maxB_in_aag(s(T66), T65, T65) → U4_aag(T66, T65, lessA_in_ag(T66, T65))
U4_aag(T66, T65, lessA_out_ag(T66, T65)) → maxB_out_aag(s(T66), T65, T65)

The argument filtering Pi contains the following mapping:
maxB_in_aag(x1, x2, x3)  =  maxB_in_aag(x3)
s(x1)  =  s(x1)
maxB_out_aag(x1, x2, x3)  =  maxB_out_aag(x1, x2)
U2_aag(x1, x2, x3)  =  U2_aag(x1, x3)
lessA_in_ag(x1, x2)  =  lessA_in_ag(x2)
lessA_out_ag(x1, x2)  =  lessA_out_ag(x1)
U1_ag(x1, x2, x3)  =  U1_ag(x3)
U3_aag(x1, x2, x3)  =  U3_aag(x2, x3)
U4_aag(x1, x2, x3)  =  U4_aag(x2, x3)
MAXB_IN_AAG(x1, x2, x3)  =  MAXB_IN_AAG(x3)
U2_AAG(x1, x2, x3)  =  U2_AAG(x1, x3)
LESSA_IN_AG(x1, x2)  =  LESSA_IN_AG(x2)
U1_AG(x1, x2, x3)  =  U1_AG(x3)
U3_AAG(x1, x2, x3)  =  U3_AAG(x2, x3)
U4_AAG(x1, x2, x3)  =  U4_AAG(x2, x3)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 1 SCC with 7 less nodes.

(8) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LESSA_IN_AG(s(T38), s(T37)) → LESSA_IN_AG(T38, T37)

The TRS R consists of the following rules:

maxB_in_aag(s(T13), 0, s(T13)) → maxB_out_aag(s(T13), 0, s(T13))
maxB_in_aag(s(T23), s(T24), s(T23)) → U2_aag(T23, T24, lessA_in_ag(T24, T23))
lessA_in_ag(0, s(T31)) → lessA_out_ag(0, s(T31))
lessA_in_ag(s(T38), s(T37)) → U1_ag(T38, T37, lessA_in_ag(T38, T37))
U1_ag(T38, T37, lessA_out_ag(T38, T37)) → lessA_out_ag(s(T38), s(T37))
U2_aag(T23, T24, lessA_out_ag(T24, T23)) → maxB_out_aag(s(T23), s(T24), s(T23))
maxB_in_aag(T47, T46, T46) → U3_aag(T47, T46, lessA_in_ag(T47, s(T46)))
U3_aag(T47, T46, lessA_out_ag(T47, s(T46))) → maxB_out_aag(T47, T46, T46)
maxB_in_aag(0, T59, T59) → maxB_out_aag(0, T59, T59)
maxB_in_aag(s(T66), T65, T65) → U4_aag(T66, T65, lessA_in_ag(T66, T65))
U4_aag(T66, T65, lessA_out_ag(T66, T65)) → maxB_out_aag(s(T66), T65, T65)

The argument filtering Pi contains the following mapping:
maxB_in_aag(x1, x2, x3)  =  maxB_in_aag(x3)
s(x1)  =  s(x1)
maxB_out_aag(x1, x2, x3)  =  maxB_out_aag(x1, x2)
U2_aag(x1, x2, x3)  =  U2_aag(x1, x3)
lessA_in_ag(x1, x2)  =  lessA_in_ag(x2)
lessA_out_ag(x1, x2)  =  lessA_out_ag(x1)
U1_ag(x1, x2, x3)  =  U1_ag(x3)
U3_aag(x1, x2, x3)  =  U3_aag(x2, x3)
U4_aag(x1, x2, x3)  =  U4_aag(x2, x3)
LESSA_IN_AG(x1, x2)  =  LESSA_IN_AG(x2)

We have to consider all (P,R,Pi)-chains

(9) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(10) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

LESSA_IN_AG(s(T38), s(T37)) → LESSA_IN_AG(T38, T37)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
LESSA_IN_AG(x1, x2)  =  LESSA_IN_AG(x2)

We have to consider all (P,R,Pi)-chains

(11) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(12) Obligation:

Q DP problem:
The TRS P consists of the following rules:

LESSA_IN_AG(s(T37)) → LESSA_IN_AG(T37)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(13) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • LESSA_IN_AG(s(T37)) → LESSA_IN_AG(T37)
    The graph contains the following edges 1 > 1

(14) YES